package com.scrawler.util;



import java.math.BigDecimal;


/**  
 * @Description: 描述
 * @author kuntang    
 * @version 1.0  
 * @created 2012-10-25 上午11:16:01 
 * Copyright (c) 2012 sohu,Inc. All Rights Reserved.
 */

public abstract class ComputeNumberUtils {

	public static float getFloatbyScale(float value,int scale){
		int   roundingMode  =  4;  //表示四舍五入，可以选择其他舍值方式，例如去尾，等等.    
		BigDecimal   bd  =   new  BigDecimal((double)value);    
		bd   =  bd.setScale(scale,roundingMode);    
		return bd.floatValue(); 
	}
	
	/**
	 * @Description:
	 * @Date: 2012-10-25
	 * @param: @param args
	 * @return: void
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		float value = 74.08000183105469f;
		System.out.println(ComputeNumberUtils.getFloatbyScale(value, 2));
	}

}
